package com.github.thinwonton.spring.web.controller;

import com.github.thinwonton.spring.entity.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class UserController {

    @RequestMapping("/user/{userid}")
    public ModelAndView queryUser(@PathVariable("userid") Long userid) {
        ModelAndView modelAndView = new ModelAndView("user");
        User user = new User();
        user.setId(userid);
        user.setName("张三");
        modelAndView.addObject("user",user);
        return modelAndView;
    }
}
